﻿using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.VisualBasic.ApplicationServices;
using SqlSugar;

namespace BloodApp.Model
{
    public partial class T_User : ObservableObject
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int UserId { get; set; }

        [ObservableProperty]
        private string userName = "string.Empty";
        public string Password { get; set; } = string.Empty;

        [ObservableProperty]
        private string templateName = string.Empty;

        [ObservableProperty]
        private string createDateTime = DateTime.Now.ToString("G");

        // 导航属性   一个用户多个订单
        [Navigate(NavigateType.OneToMany, nameof(T_Order.UserId))]
        public List<T_Order> Orders { get; set; }
    }
    public partial class T_Order : ObservableObject
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int OrderId { get; set; }
        [ObservableProperty]
        private decimal amount = 0;
        public DateTime OrderDate { get; set; }
        public int UserId { get; set; } // 外键
    }
}
